﻿
Public Class Game
    Private myPlayers As List(Of Player)
    Private myRounds As List(Of Round)
    Private myScoreTeam1 As Integer
    Private myScoreTeam2 As Integer

    Public Sub New(ByVal players As List(Of Player))
        myPlayers = players
        myRounds = New List(Of Round)
        myScoreTeam1 = 0
        myScoreTeam2 = 0
    End Sub

    Public Sub Start()
        'Play rounds while until a team reaches 10 points
        LaunchGameBoard()
        Dim dealer As Integer = 1
        While myScoreTeam1 < 10 And myScoreTeam2 < 10
            'Create a round
            Dim round As New Round(myPlayers(dealer), myPlayers)
            round.Start()

            Select Case round.Winner
                Case Team.One
                    myScoreTeam1 += round.PointsAwarded
                Case Team.Two
                    myScoreTeam2 += round.PointsAwarded
            End Select
            'Store round info
            myRounds.Add(round)
            'TODO
            'update the scoreboard display
        End While

        'TODO Display game summary info
    End Sub

    Private Sub LaunchGameBoard()
        For Each plr In myPlayers
            plr.Client.SendMessage("LAUNCH|GAMEBOARD")
        Next
    End Sub
End Class
